var bootbox_global;
var grid;




//查看对象
function viewObj(objid,datarow) {


    show_div_grid();

    var obj = grid.date_list[datarow];

    var columns = [
        {title : '编号',dataIndex :'User_ID',dataSource:function(data,datarow,gridobj,current_column) {

            return "<span>"+parseInt( (gridobj.current_page-1)*gridobj.page_rows+parseInt(datarow)+1)+"</span>";
        }},

        {title: '案例id', dataIndex: 'case_id',},


        {
            title: '类型', dataIndex: 'gender', dataSource: function (data, datarow, gridobj, current_column) {

            var obj = data[datarow];

            var housetype = obj.house_type;

            var index_num =  parseInt(obj.index_num)+1;

            return housetype+"-"+index_num;


        }
        },

        {title: '长', dataIndex: 'length',},
        {title: '宽', dataIndex: 'width',},
        {title: '高', dataIndex: 'height',},
        {title: '地面', dataIndex: 'ground_type_name',},
        {title: '墙面', dataIndex: 'wall_type_name',},


        { title: '提交时间', dataIndex: 'create_time',},



    ];

    grid_show = new Grid("/budget/getDetailListPaging", $("#table_my_toast1"), $("#paging_my_toast1"), 1, 10, columns, "&case_id="+obj.id, 10);

    //初始化
    grid_show.Init();



    return;



}

define([
    "jquery",
    "IO",
    "bootbox"
], function ($, IO, bootbox) {

    bootbox_global = bootbox;
    $(function () {

        //每列数据列性
        var columns = [

            {
                title: '编号', dataIndex: 'User_ID', dataSource: function (data, datarow, gridobj, current_column) {

                return "<span>" + parseInt((gridobj.current_page - 1) * gridobj.page_rows + parseInt(datarow) + 1) + "</span>";
            }
            },
            //{ title: '种类id', dataIndex: 'type_id',},
            {title: '用户id', dataIndex: 'user_id',},
            {
                title: '状态', dataIndex: 'gender', dataSource: function (data, datarow, gridobj, current_column) {

                var obj = data[datarow];

                if(obj.status == 0)
                    return "信息未填写完整";

                if(obj.status == 1)
                    return "信息验证成功";

                return "";




            }
            },

            {
                title: '输入信息', dataIndex: 'gender', dataSource: function (data, datarow, gridobj, current_column) {

                var obj = data[datarow];

                var remark = obj.input_desc;


                return remark;



            }
            },
            {title: '创建时间', dataIndex: 'create_time',},
            {
                title: '操作', dataIndex: 'User_ID', dataSource: function (data, datarow, gridobj, current_column) {

                var html = "<div class='div_btn'><button onclick=\"viewObj(" + data[datarow].id + "," + datarow + ")\" class='btn btn-info'>查看详情</button> ";



                html = html + "</div>"

                return html;
            }
            },


        ];


        //数组初始化

        function dataInit() {
            grid = new Grid("/budget/getBudgetCaseListPaging", $("#table_my_toast"), $("#paging_my_toast"), 1, 10, columns, get_input_param(), 20);

            //初始化
            grid.Init();
        }

        //获取输入框内容
        function get_input_param() {

            var param = "name=" + $("#name").val();

            return param;

        }

        dataInit();
        //查询
        $("#query").bind("click", function () {
            dataInit();
        });
    });


});